import Home from '../page/home';
import Historylog from '../page/log-history';
import Realtimelog from '../page/log-realtime';
import OfflineLog from '../page/log-offline';
import ProjectEdit from '../page/project-edit';
import ProjectMember from '../page/project-member';
import ProjectList from '../page/project-list';
import ProjectApply from '../page/project-apply';
import UserManage from '../page/user-manage/index';
import DailyStatics from '../page/project-daily-statics';
import ChangeLog from '../page/changelog';
import Sourcemap from '../page/sourcemap';
import StaticSpeed from '../page/static-speed';
import FetchSpeed from '../page/fetch-speed';
import Help from '../page/help';
import WhiteList from '../page/white-list';
import PageSpeed from '../page/page-speed';

import { ReactComponentLike } from "prop-types";


export type MenuRoute = {
    key: string,
    name: string,
    icon?: string,
    path?: string,
    showInMenu?: boolean,
    component?: ReactComponentLike,
    child?: MenuRoute[],
    exactly?: boolean,
    strict?: boolean,
    authority?: object // 用户鉴权
}

const menu: MenuRoute[] = [
    {
        key: '5',
        name: '主页',
        icon: 'home',
        path: '/',
        component: Home,
        exactly: true
    },
    {
        key: '1',
        name: '日志',
        icon: 'file',
        path: '/log',
        child: [{
            name: '项目历史日志',
            key: '102',
            path: '/historylog',
            component: Historylog
        }, {
            name: '项目实时日志',
            key: '103',
            path: '/realtimelog',
            component: Realtimelog
        }, {
            name: '项目离线日志',
            key: '104',
            path: '/offlinelog',
            component: OfflineLog
        }, {
            name: '项目日志统计',
            key: '105',
            path: '/project-daily-statics',
            component: DailyStatics
        }, {
            name: 'SourceMap',
            key: '107',
            path: '/sourcemap',
            component: Sourcemap,
            showInMenu: false
        }]
    }, {
        key: '2',
        name: '测速',
        icon: 'clock-circle',
        path: '/speed',
        child: [, {
            name: '页面测速',
            key: '203',
            path: '/pagespeed',
            component: PageSpeed
        }, {
                name: 'CGI测速',
                key: '201',
                path: '/cgispeed',
                component: FetchSpeed
            }, {
                name: '静态资源测速',
                key: '202',
                path: '/static-speed',
                component: StaticSpeed
            }]
    }, {
        key: '3',
        name: '项目管理',
        icon: 'project',
        path: '/project',
        child: [{
            name: '申请项目',
            key: '301',
            path: '/projectapply',
            component: ProjectApply
        }, {
            name: '项目列表',
            key: '302',
            path: '/projectlist',
            component: ProjectList
        }, {
            name: '项目用户管理',
            key: '303',
            path: '/projectmember',
            component: ProjectMember
        }, {
            name: '平台用户管理',
            authority: [1],
            key: '304',
            path: '/usermanage',
            component: UserManage
        }, {
            showInMenu: false,
            name: '项目编辑',
            key: '305',
            path: '/projectedit',
            component: ProjectEdit
        }, {
            authority: [1],
            name: '白名单',
            key: '306',
            path: '/whitelist',
            component: WhiteList
        }]
    }, {
        key: '4',
        name: '关于',
        icon: 'solution',
        path: '/about',
        child: [{
            name: '使用帮助',
            path: '/help',
            key: '401',
            component: Help
        }, {
            name: '更新日志',
            path: '/changelog',
            key: '402',
            component: ChangeLog
        }]
    }]

export default menu;
